package com.platform.comm.entity.generate;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.UUIDGenerator;

import java.io.Serializable;

/**
 * Description: 自定义ID生成器（继承UUIDGenerator）
 *
 * @author libin Created on 2019/7/20
 **/
public class UUID2Generator extends UUIDGenerator {

    @Override
    public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
        return StringUtils.replace(String.valueOf(super.generate(session, object)), "-", "");
    }
}
